# @Time: 2025/4/29 13:49
# @Author: chenhui
import yaml
from common.tools import get_project_path,sep

class GetConf:
    def __init__(self):
        project_dir = get_project_path()
        #with  open的第一个参数填写environment.yaml的绝对路径
        with open(project_dir+sep(['config','environment.yaml'],add_sep_before=True), 'r',
                  encoding='utf-8') as env_file:
            self.env = yaml.load(env_file,Loader=yaml.FullLoader)
            # print(self.env)
    def get_username_password(self,user):
        return self.env["user"][user]['username'], self.env["user"][user]['password']

    def get_url(self):
        """
        获取测试地址
        :return:
        """
        return self.env['url']


    def get_mysql_config(self):
        return self.env["mysql"]
# if __name__ == '__main__':
#     # print(GetConf().get_mysql_config())
#     GetConf().yuanzu()
